package com.hbpu.encap.homework02;

public class Homework05 {
    public static void main(String[] args) {
        Horse horse = new Horse();
        Boat boat = new Boat();
        Person person = new Person("唐僧", horse);
        Person person1 = new Person("唐僧", boat);
    }
}

interface Vehicles {
    void work();
}

class Horse implements Vehicles {
    @Override
    public void work() {
        System.out.println("Horse工作");
    }
}

class Boat implements  Vehicles {
    @Override
    public void work() {
        System.out.println("Boat工作");
    }
}

class Person {
    private String name;
    private Vehicles vehicles;

    public Person(String name, Vehicles vehicles) {
        this.name = name;
        this.vehicles = vehicles;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Vehicles getVehicles() {
        return vehicles;
    }

    public void setVehicles(Vehicles vehicles) {
        this.vehicles = vehicles;
    }
}